<?php
namespace App\Service;

use Illuminate\Support\Facades\DB;

class BaseService
{
    //基础类

    protected static $db;
    protected static $dbShelf = 'shelf';
    protected static $dbCangwei = 'cangwei';
    protected static $dbHuowu = 'huowu';
    protected static $dbHwcw = 'hw_cw';
    protected static $dbHwMove = 'hw_move';

    //连接数据库
    public static function dbConn($db)
    {
        return DB::connection('mysql')->table($db);
    }

    //返回格式
    public static function toback($code = 0, $msg = '', $data = [], $total = 0)
    {
        $msg = $msg ? $msg : '成功';
        return [
            'code' => $code,
            'msg' => $msg,
            'data' => $data,
            'total' => $total,
        ];
    }
}